#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
    //freopen("in.txt","r",stdin);
    char s1[15];
    char s2[1000005];
    fgets(s1,15,stdin);
    fgets(s2,1000000,stdin);
    int s1Len = strlen(s1);
    int s2Len = strlen(s2);
    for(int i = 0; i< s1Len; i++)
    {
        if('A' <= s1[i] && s1[i] <= 'Z') s1[i] = s1[i]-'A'+'a';
    }
    for(int i = 0; i< s2Len; i++)
    {
        if('A' <= s2[i] && s2[i] <= 'Z') s2[i] = s2[i]-'A'+'a';
    }
    int first = -1;
    int count = 0;
    int i = 0;
    int j = 0;
    while (i < s2Len)
    {
        j = 0;
        if(s2[i] == s1[j])
        {
            int flag = 0;
            if(i!=0 && s2[i-1] == ' ') flag = 1;
            while (s2[i] == s1[j])
            {
                i++;
                j++;
            }
            if(j == s1Len-1 && s2[i] == ' ') 
            {
                if(flag)
                {
                    if(first == -1) first = i-j;
                    count++;
                }
            }
        }
        i++;
    }
    if(count == 0) printf("-1");
    else printf("%d %d",count,first);
}